package tedu.spring.eg3;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Repository;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
@Repository
public class ShopController {
    private String name;

    public ShopController() {
        System.out.println("1：实例化[无参构造]");
    }
    @Value("小明")
    public void setName(String name) {
        this.name = name;
        System.out.println("2：属性赋值[set方法]");
    }

    @PostConstruct
    public void init() {
        System.out.println("3：生命周期初始化init方法");
    }

    @PreDestroy
    public void destroy() {
        System.out.println("5：生命周期销毁destroy方法");
    }
}
